<template>
  <div id="app">
    <keep-alive>
      <router-view v-if="$route.meta.keepAlive" :client-width="clientWidth" />
    </keep-alive>
    <router-view v-if="!$route.meta.keepAlive" :client-width="clientWidth" />
  </div>
</template>

<script>
export default {
  data() {
    return {
      clientWidth: document.body.clientWidth
    }
  },
  beforeCreate() {
    const redirect = sessionStorage.getItem('redirect')
    if (redirect) {
      this.$store.dispatch('user/setRedirect', redirect)
    }
  },
  created() {
    const self = this
    // 路由
    window.onresize = function() {
      self.clientWidth = document.body.clientWidth
    }
  }
}
</script>

<style lang="scss">
  #nav {
    padding: 30px;
    text-align: center;

    a {
      font-weight: bold;
      color: #2c3e50;
      &.router-link-exact-active {
        color: #42b983;
      }
    }
  }
  .amap-logo,
  .amap-copyright {
    display: none !important;
  }
	.amap-sug-result{
		z-index: 99999!important;
	}
</style>
